<html>
<head>
    <meta charset="utf-8" />
    <title>登录</title>
    <link rel="stylesheet" href="/static/css/login.css">
<!--    <link rel="stylesheet" href="/www/static/css/awesome.css">-->
    <script src="/static/js/jquery.min.js"></script>
    <script src="/static/js/sha1.min.js"></script>
    <script src="/static/js/vue.min.js"></script>
    <script src="/static/js/awesome.js"></script>
    <script>

$(function() {
    var vmAuth = new Vue({
        el: '#vm',
        data: {
            email: '',
            password: ''
        },
        methods: {
            submit: function(event) {
                event.preventDefault();
                var
                    $form = $('#vm'),
                    email = this.email.trim().toLowerCase(),
                    data = {
                        email: email,
                        password: this.password==='' ? '' : CryptoJS.SHA1(email + ':' + this.password).toString()
                    };
                $form.postJSON('/api/authenticate', data, function(err, result) {
                    if (! err) {
                        location.assign('/');
                    }
                });
            }
        }
    });
});

    </script>
</head>
<body>
    <form id="vm" v-on="submit: submit" class="login">
        <h3>用户登录</h3>
        <div class="login_box">
            <input v-model="email" name="email" type="text" required="required">
            <label for="">邮箱</label>
        </div>
        <div class="login_box">
            <input v-model="password" name="password" type="password" required="required">
            <label for="">密码</label>
        </div>
        <button type="submit">
            登录
            <span></span>
            <span></span>
            <span></span>
            <span></span>
        </button>
    </form>
</body>
</html>